package com.example.beautymakeup.controller;

import com.example.beautymakeup.dao.CommentDao;
import com.example.beautymakeup.domain.Code;
import com.example.beautymakeup.domain.Result;
import com.example.beautymakeup.pojo.Comment;
import com.example.beautymakeup.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/comment")
public class CommentController {
    @Autowired
    private CommentService commentService;

    @PostMapping
    public Result add(@RequestHeader("Shop_token") String token,@RequestBody Comment comment) throws Exception {
        boolean add = commentService.add(token, comment);
        if (add){
            return new Result(Code.SAVE_OK,"评价成功");
        }
        return new Result(Code.SAVE_ERR,"评价失败");
    }
}
